//
//  GKZYSelectionDetailController.m
//  GKZYAid
//
//  Created by lanou3g on 16/2/29.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYSelectionDetailController.h"
#import "Urls.h"
@interface GKZYSelectionDetailController ()<UIWebViewDelegate>

@property (nonatomic,strong)UIWebView *webView;
@property (nonatomic,strong)UIActivityIndicatorView *activityView;

@end

@implementation GKZYSelectionDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tabBarController.tabBar.hidden = NO;
    
    self.webView = [[UIWebView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    
    //自适应屏幕:
    self.webView.scalesPageToFit = YES;
    
    //打开响应者链:
    self.webView.userInteractionEnabled = YES;
    
    //添加:
    [self.view addSubview:self.webView];
    
    //拼接网址:
    NSString *url = [KURLDetail stringByAppendingString:self.modelDetail.news_id];
    
    //请求数据:
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    
    //发送数据请求:
    [self.webView loadRequest:request];
    
    //设置代理:
    self.webView.delegate = self;
    
    
}

- (void)webViewDidStartLoad:(UIWebView *)webView{
    
    UIView *backView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    backView.backgroundColor = [UIColor lightGrayColor];
    backView.alpha = 0.5;
    backView.tag = 101;
    [self.view addSubview:backView];
    
    self.activityView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    self.activityView.frame = [UIScreen mainScreen].bounds;
    self.activityView.center = backView.center;
    self.activityView.backgroundColor = [UIColor grayColor];
    [self.activityView startAnimating];
    [backView addSubview:self.activityView];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView{
    
    UIView *view = [self.view viewWithTag:101];
    [self.activityView stopAnimating];
    [view removeFromSuperview];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
